package cn.ligoo.dtu.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.ligoo.dtu.Constants;
import cn.ligoo.dtu.dao.BmuMasterInfoDao;
import cn.ligoo.dtu.dao.DtuInfoDao;
import cn.ligoo.dtu.domain.BmuMasterInfo;
import cn.ligoo.dtu.domain.DtuInfo;
import cn.ligoo.dtu.service.BmuMasterInfoService;

/**
 * @author Jin,QingHua
 * @version 2012-07-24 12:18:52
 */
@Service
public class BmuMasterInfoServiceImpl implements BmuMasterInfoService {

	@Resource
	private DtuInfoDao dtuInfoDao;

	@Resource
	private BmuMasterInfoDao bmuMasterInfoDao;

	@Override
	public Integer createBmuMasterInfo(BmuMasterInfo t) {
		DtuInfo di = new DtuInfo();
		di.setId(t.getDtu_info_id());
		di.setIs_online(Constants.BYTE_1);
		di.setRefresh_time(new Date());
		this.dtuInfoDao.updateEntity(di);
		this.bmuMasterInfoDao.insertEntity(t);
		return t.getId();
	}

	@Override
	public int modifyBmuMasterInfo(BmuMasterInfo t) {
		return this.bmuMasterInfoDao.updateEntity(t);
	}

	@Override
	public int removeBmuMasterInfo(BmuMasterInfo t) {
		return this.bmuMasterInfoDao.deleteEntity(t);
	}

	@Override
	public BmuMasterInfo getBmuMasterInfo(BmuMasterInfo t) {
		return this.bmuMasterInfoDao.selectEntity(t);
	}

	@Override
	public Integer getBmuMasterInfoCount(BmuMasterInfo t) {
		return this.bmuMasterInfoDao.selectEntityCount(t);
	}

	@Override
	public List<BmuMasterInfo> getBmuMasterInfoList(BmuMasterInfo t) {
		return this.bmuMasterInfoDao.selectEntityList(t);
	}

}
